<!--
 * FCKeditor - The text editor for internet
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
 *
 * Licensed under the terms of the GNU Lesser General Public License:
 * 		http://www.opensource.org/licenses/lgpl-license.php
 *
 * For further information visit:
 * 		http://www.fckeditor.net/
 *
 * "Support Open Source software. What about a donation today?"
 *
 * File Name: browser.html
 * 	This page compose the File Browser dialog frameset.
 *
 * File Authors:
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>FCKeditor - Resources Browser</title>
    <link href="/fckeditor/browser.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/fckeditor/fckxml.js"></script>
    <script language="javascript">
    <!--
function GetUrlParam( paramName )
{
  var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
  var oMatch = oRegex.exec( window.top.location.search ) ;

  if ( oMatch && oMatch.length > 1 )
    return unescape( oMatch[1] ) ;
  else
    return '' ;
}

var oConnector = new Object() ;
oConnector.CurrentFolder	= '/' ;

var sConnUrl = GetUrlParam( 'Connector' ) ;

// Gecko has some problems when using relative URLs (not starting with slash).
oConnector.ConnectorUrl = '/admin_tree/process_command';

oConnector.SendCommand = function( command, params, callBackFunction )
{
  var sUrl = this.ConnectorUrl + '?Command=' + command ;
  sUrl += '&CurrentFolder=' + escape( this.CurrentFolder ) ;

  if ( params ) sUrl += '&' + params ;

  var oXML = new FCKXml() ;

  if ( callBackFunction )
    oXML.LoadUrl( sUrl, callBackFunction ) ;	// Asynchronous load.
  else
    return oXML.LoadUrl( sUrl ) ;
}

oConnector.CheckError = function( responseXml )
{
  var iErrorNumber = 0
  var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;

  if ( oErrorNode )
  {
    iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value ) ;

    switch ( iErrorNumber )
    {
      case 0 :
        break ;
      case 1 :	// Custom error. Message placed in the "text" attribute.
        alert( oErrorNode.attributes.getNamedItem('text').value ) ;
        break ;
      case 101 :
        alert( 'Folder already exists' ) ;
        break ;
      case 102 :
        alert( 'Invalid folder name' ) ;
        break ;
      case 103 :
        alert( 'You have no permissions to create the folder' ) ;
        break ;
      case 110 :
        alert( 'Unknown error creating folder' ) ;
        break ;
      default :
        alert( 'Error on your request. Error number: ' + iErrorNumber ) ;
        break ;
    }
  }
  return iErrorNumber ;
}

var oIcons = new Object() ;

oIcons.AvailableIconsArray = [
  'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
  'mdb','mp3','pdf','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;

oIcons.AvailableIcons = new Object() ;

for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
  oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;

oIcons.GetIcon = function( fileName )
{
  var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;

  if ( this.AvailableIcons[ sExtension ] == true )
    return sExtension ;
  else
    return 'default.icon' ;
}

    -->
    </script>
  </head>
  <frameset cols="150,*" class="Frame" framespacing="3" bordercolor="#f1f1e3" frameborder="1">
    <frame name="frmFolders" src="/admin_tree/folders" scrolling="auto" frameborder="1" />
    <frame name="frmResourcesList" src="/admin_tree/resources_list" scrolling="auto" frameborder="1" />
  </frameset>
</html>
